package main

import (
	"fmt"
	"time"
)

func main() {

	//日期转化为时间戳
	datetime := "2022-11-22"  //待转化为时间戳的字符串
	//日期转化为时间戳
	timeLayout := "2006-01-02"  //转化所需模板
	loc, _ := time.LoadLocation("Local")    //获取时区
	tmp, _ := time.ParseInLocation(timeLayout, datetime, loc)
	timestamp := tmp.Unix()    //转化为时间戳 类型是int64
	fmt.Println(timestamp)

}
